package top.foxhome.web.spiders;

import java.util.ArrayList;
import java.util.List;

public class BrowsCache {
    private List<String> doneUrl;

    public BrowsCache() {
        doneUrl = new ArrayList<String>();
    }

    /**
     * 判断该链接是否已经被爬取
     *
     * @param url
     * @return
     */
    public boolean contains(String url) {
        return doneUrl.contains(url);
    }

    /**
     * 添加链接
     *
     * @param url
     */
    public void addUrl(String url) {
        doneUrl.add(url);
    }

    /**
     * 清空链接
     */
    public void clear() {
        doneUrl.clear();
    }

    public int pageCount() {
        return doneUrl.size();

    }
}
